/* style.css (完整替换) */

/* 轻量弹窗与按钮样式，风格与现有扩展一致 */
:root {
  --spa-z: 2147483646;
  --spa-overlay: rgba(0,0,0,.6);
  --spa-bg: #2c2f33;
  --spa-fg: #fff;
  --spa-border: #40444b;
  --spa-accent: #7289da;
}

#spa-fab {
  position: fixed;
  z-index: var(--spa-z);
  right: 20px; /* 统一 JS 中的默认值 */
  bottom: 20px; /* 统一 JS 中的默认值 */
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg,#2f3338,#212529);
  color: var(--spa-accent);
  font-size: 22px;
  cursor: grab;
  box-shadow: 0 4px 8px rgba(0,0,0,.3), inset 0 2px 2px rgba(255,255,255,.05);
  transition: transform .2s ease-out;
}
#spa-fab:hover { transform: scale(1.06); }

#spa-overlay {
  position: fixed; inset: 0;
  background: var(--spa-overlay);
  z-index: var(--spa-z);
  display: none;
}

#spa-modal {
  position: absolute; inset: 0;
  display: grid; place-items: center;
}

#spa-card {
  width: 90vw; /* 优化移动端宽度 */
  height: 85vh;
  max-width: 900px; /* 最大宽度限制 */
  background: var(--spa-bg); color: var(--spa-fg);
  border: 1px solid var(--spa-border);
  border-radius: 10px; box-shadow: 0 8px 16px rgba(0,0,0,.25);
  position: relative;
  display: flex; /* 使用 flex 布局 */
  flex-direction: column;
  overflow: hidden; /* 隐藏子元素溢出 */
}

#spa-close {
  position: absolute;
  top: 10px; right: 10px;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: none;
  background: rgba(0,0,0,0.2);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  font-weight: bold;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  transition: background .2s ease, transform .2s ease;
}
#spa-close:hover {
  background: rgba(0,0,0,0.4);
  transform: scale(1.1);
}

/* ======================================= */
/* === 从 RAW_HTML 迁移并适配的样式 === */
/* ======================================= */

#spa-content-container {
  flex-grow: 1;
  overflow-y: auto;
  font-family: 'Microsoft YaHei','Segoe UI',Arial,sans-serif;
}
#spa-content-container * { box-sizing: border-box; }

/* 隐藏滚动条 */
#spa-content-container::-webkit-scrollbar { display: none; }
#spa-content-container { -ms-overflow-style: none; scrollbar-width: none; }

#spa-iframe-content .card {
  background: var(--spa-bg);
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

#spa-iframe-content .header {
  background: linear-gradient(135deg, #40444b, #212529); /* 调整为深色主题 */
  color: #fff;
  padding: 16px 20px;
  text-align: center;
  flex-shrink: 0;
  border-bottom: 1px solid var(--spa-border);
}
#spa-iframe-content .header h1 { font-size: 1.3em; margin-bottom: 4px; font-weight: 600; }
#spa-iframe-content .header p { font-size: .82em; opacity: .8; }

#spa-iframe-content .content { padding: 18px 20px; display: flex; flex-direction: column; gap: 16px; flex: 1; }

#spa-iframe-content .mode-tabs { display: flex; background: #212529; border-radius: 10px; padding: 3px; box-shadow: inset 0 1px 3px rgba(0,0,0,0.3); flex-shrink: 0; }
#spa-iframe-content .tab-btn { flex: 1; padding: 10px 16px; border: none; border-radius: 7px; font-size: .88em; font-weight: 500; cursor: pointer; transition: all .25s ease; background: transparent; color: #ccc; }
#spa-iframe-content .tab-btn.active { background: var(--spa-accent); color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.3); transform: translateY(-1px); }

#spa-iframe-content .tab-content { display: none; animation: fadeIn .3s ease; flex: 1; min-height: 0; }
#spa-iframe-content .tab-content.active { display: flex; flex-direction: column; }
@keyframes fadeIn{ from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:translateY(0)} }

#spa-iframe-content .main-layout { display: flex; flex-direction: column; gap: 16px; flex: 1; align-items: start; }
#spa-iframe-content .section { flex: 1; width: 100%; background: #36393f; border-radius: 10px; padding: 14px; border: 1px solid var(--spa-border); transition: all .2s ease; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
#spa-iframe-content .section:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.2); border-color: #50545b; }
#spa-iframe-content .section-title { font-size: .9em; font-weight: 600; color: #eee; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }

#spa-iframe-content .list-box { max-height: 20vh; overflow: auto; border: 1px solid var(--spa-border); border-radius: 6px; padding: 6px; margin: 8px 0; font-size: .82em; background: #2f3136; }
#spa-iframe-content .item-row { display: flex; align-items: center; padding: 6px 8px; margin-bottom: 3px; background: #3a3d42; border-radius: 4px; transition: all .2s ease; border: 1px solid transparent; }
#spa-iframe-content .item-row:hover { background: #40444b; border-color: #50545b; }
#spa-iframe-content .item-row input[type="checkbox"] { margin-right: 8px; transform: scale(.9); cursor: pointer; accent-color: var(--spa-accent); }
#spa-iframe-content .item-name { font-weight: 500; color: #eee; font-size: .88em; }
#spa-iframe-content .item-desc { font-size: .75em; color: #aab; margin-top: 1px; }

#spa-iframe-content .resource-section,
#spa-iframe-content .config-section { display: flex; flex-direction: column; width: 100%; gap: 16px; }

#spa-iframe-content .selection-tabs { display: flex; border-bottom: 1px solid var(--spa-border); margin-bottom: 10px; }
#spa-iframe-content .selection-tab-btn { padding: 8px 14px; cursor: pointer; border: none; background: none; font-size: .88em; color: #bbb; border-bottom: 2px solid transparent; transition: all .2s ease; }
#spa-iframe-content .selection-tab-btn.active { color: #fff; font-weight: 600; border-bottom-color: var(--spa-accent); }
#spa-iframe-content .selection-content { display: none; }
#spa-iframe-content .selection-content.active { display: block; }

#spa-iframe-content .option-title { font-size: .9em; font-weight: 600; margin-bottom: 10px; color: #eee; }
#spa-iframe-content .checkbox-option { padding: 8px 12px; border: 1px solid var(--spa-border); border-radius: 6px; font-size: .88em; background: #3a3d42; color: #ddd; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
#spa-iframe-content .checkbox-option label { cursor: pointer; }

#spa-iframe-content .btn { background: var(--spa-accent); color: #fff; border: none; padding: 8px 14px; border-radius: 18px; font-size: .82em; font-weight: 500; cursor: pointer; transition: all .25s ease; margin: 2px; box-shadow: 0 2px 4px rgba(0,0,0,.2); }
#spa-iframe-content .btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.3); filter: brightness(1.1); }
#spa-iframe-content .btn-success { background: #43b581; }
#spa-iframe-content .btn-success:hover { background: #3aa576; }

#spa-iframe-content .input-field { width: 100%; padding: 8px 12px; border: 1px solid var(--spa-border); border-radius: 6px; font-size: .88em; margin-bottom: 6px; background: #212529; color: #ddd; }
#spa-iframe-content .input-field:focus { outline: none; border-color: var(--spa-accent); box-shadow: 0 0 0 2px rgba(114, 137, 218, .3); }
#spa-iframe-content .input-group { display: flex; gap: 8px; margin-bottom: 10px; }

#spa-iframe-content .file-upload { display: inline-block; background: #4f545c; color: #fff; padding: 10px 16px; border-radius: 18px; cursor: pointer; font-size: .82em; font-weight: 500; transition: all .25s ease; box-shadow: 0 2px 4px rgba(0,0,0,.2); position: relative; }
#spa-iframe-content .file-upload:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.3); background: #5c626b; }
#spa-iframe-content .file-upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

#spa-iframe-content .status-msg { padding: 10px 14px; border-radius: 8px; margin: 10px 0; font-size: .82em; font-weight: 500; text-align: center; display: none; border-left: 4px solid; color: #fff; }
#spa-iframe-content .status-success { background: #28a745; border-color: #218838; }
#spa-iframe-content .status-error { background: #dc3545; border-color: #c82333; }
#spa-iframe-content .status-info { background: #6c757d; border-color: #5a6268; }

#spa-iframe-content .progress { width: 100%; height: 3px; background: #212529; border-radius: 2px; margin: 10px 0; display: none; }
#spa-iframe-content .progress-bar { height: 100%; background: var(--spa-accent); width: 0%; transition: width .3s ease; }

#spa-iframe-content .package-info { background: #3a3d42; border: 1px solid var(--spa-border); border-radius: 8px; padding: 12px; margin: 10px 0; font-size: .82em; display: none; }
#spa-iframe-content .package-info h4 { margin-bottom: 8px; color: #eee; font-size: .9em; }

#spa-iframe-content .debug-log { background: #212529; border: 1px solid var(--spa-border); border-radius: 8px; padding: 10px; font-family: 'Courier New', monospace; font-size: .72em; max-height: 120px; overflow-y: auto; display: none; color: #ccc; }
#spa-iframe-content .empty-state { text-align: center; color: #888; font-size: .82em; padding: 12px; font-style: italic; }

/* 响应式布局：针对移动端优化 */
@media (max-width: 768px) {
  /* 已有的移动端样式 */
  #spa-card { width: 95vw; height: 90vh; }
  #spa-iframe-content .content { padding: 14px 16px; gap: 14px; }
  #spa-iframe-content .input-group { flex-direction: column; gap: 6px; }
  #spa-iframe-content .list-box { max-height: 18vh; }

  /* -- 新增: 优化悬浮球显示 -- */
  #spa-fab {
    width: 44px;
    height: 44px;
    font-size: 20px;
    right: 16px;
    bottom: 80px; 
  }
}